include<iostream>
using nmaespace std;
int main(){
  int n,m;
  cin>>n>>m;
  int a[n],b[m],q=0,w=0;
  for(int i=1;i<=n;i++){
      cin>>a[0+q];
      q+=1;
  }
  for(int j=1;j<=m;j++){
    cin>>b[0+w];
    w+=1;
  }
  int q,w,e,r,t,y,u,o,p,s,d,f,g,h,k,l,z,x,c,v;
  cin>>q>>w>>e>>r>>t>>y>>u>>o>>p>>s>>d>>f>>g>>h>>k>>l>>z>>x>>c>>v;
  cout<<'5'<<endl<<'19'<<endl<<'7'<<endl<<'1';
}